﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	{include file="public/css"}
	<title>学员列表</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i>首页<span class="c-gray en">&gt;</span>
		学员管理
		<span class="c-gray en">&gt;</span>
		学员列表
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
			<i class="Hui-iconfont">
				&#xe68f;
			</i>
		</a>
	</nav>
	<div class="page-container">
		<form action="{:url('student_list')}" method="get">
			<div class="text-c"> 日期范围：
				<input type="text" name="stime" value="{$stime}" onfocus="WdatePicker()" id="datemin" class="input-text Wdate" style="width:120px;">
				-
				<input type="text" name="etime" value="{$etime}" onfocus="WdatePicker()" id="datemax" class="input-text Wdate" style="width:120px;">
				{if condition="session('atype') neq 1"}<input type="text" class="input-text" style="width:200px" value="{$sname}" placeholder="输入机构名称" name="sname">{/if}
				<input type="text" class="input-text" style="width:200px" value="{$name}" placeholder="输入学员姓名或身份证号" name="name">
				<button type="submit" class="btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 点击搜索</button>
				<button type="button" class="getList btn btn-success" style="background-color: #fb0303;border-color: #fb0303;"><i class="Hui-iconfont">&#xe640;</i> 下载列表</button>
			</div>
		</form>
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				{if condition="session('atype') heq 0"}
				<a href="javascript:;" class="btn btn-danger radius delAll">
					<i class="Hui-iconfont">&#xe6e2;</i>
					批量删除
				</a>
				{/if}
				{if condition="session('atype') neq 1"}<a href="{:url('student_add')}" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 考生添加</a>{/if}
				<a href="{:url('student_add_all')}" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 考试表格上传</a>
				<a href="{:url('student_img_all')}" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 考生照片上传</a>
			</span>
			<span class="r">
				共有数据：<strong>{$list->total()}</strong>条
			</span>
		</div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
				<thead>
					<tr class="text-c">
						{if condition="session('atype') heq 0"}
						<th width="25"><input type="checkbox" name="" value=""></th>
						{/if}
						<th width="50">ID</th>
						<th>一寸照</th>
						<th>姓名</th>
						<th>性别</th>
						<th>年龄</th>
						<th>身份证号</th>
						<th>联系电话</th>
						<th>培训机构</th>
						<th>添加时间</th>
						<!-- <th>认证状态</th> -->
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					{volist name="list" id="n"}
					<tr class="text-c">
						{if condition="session('atype') heq 0"}
						<td>
							<input type="checkbox" name="ids" value="{$n.id}">
						</td>
						{/if}
						<td>{$n.id}</td>
						<td>{if condition="$n.img neq ''"}<img src="{$n.img}" style="max-width:100px;max-height:100px;">{/if}</td>
						<td>{$n.name}</td>
						<td>{:$n.sex==1?'男':''}{:$n.sex==2?'女':''}</td>
						<td>{$n.age}</td>
						<td>{$n.idcard}</td>
						<td>{$n.tel}</td>
						<td>{$n.sname}</td>
						<td>{:date("Y-m-d H:i",$n.time)}</td>
						<!-- <td>
							{if condition="$n.state eq 1"}
							<span class="label label-success radius">已认证</span>
							{else /}
							<span class="label label-error radius" data-id="{$n.id}" style="cursor: pointer;">未认证</span>
							{/if}
						</td> -->
						<td class="f-14 td-manage">
							<a style="text-decoration:none" class="ml-5 student-look" title="查看" data-id="{$n.id}">
								<i class="Hui-iconfont">&#xe725;</i>
							</a>
							<a style="text-decoration:none" class="ml-5" href="{:url('index/student_add')}?id={$n.id}" title="编辑">
								<i class="Hui-iconfont">&#xe6df;</i>
							</a>
							{if condition="session('atype') heq 0"}
							<a style="text-decoration:none" class="ml-5 del" href="javascript:;" data-id="{$n.id}" title="删除">
								<i class="Hui-iconfont">&#xe6e2;</i>
							</a>
							{/if}
						</td>
					</tr>
					{/volist}
				</tbody>
			</table>
			<div class="page">{:$list->render()}</div>
		</div>
	</div>
	<!--_footer 作为公共模版分离出去-->	
	{include file="public/js"}
	<!--/_footer 作为公共模版分离出去-->
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript" src="/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="/admin/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript">
		function del(id){
			var index=layer.confirm('确定删除数据？',{btn:['确定','取消']},function(){
				layer.close(index);
				$.post("{:url('studentDel')}",{id:id},function(res){
					console.log(res)
					if (res.state==200) {
						layer.msg(res.msg,{icon:1,time:1500},function(){
							window.location.reload();
						})
					}else{
						layer.msg(res.msg,{icon:2,time:1500});
					}
				})
			})
		}
		$(".delAll").click(function(){
			var ids='';
			$("input[name=ids]:checked").each(function(){
				if (ids!='') {
					ids+=','+$(this).val();
				}else{
					ids=$(this).val();
				}
			})
			if (ids!='') {
				del(ids);
			}else{
				layer.msg('删除数据不能为空',{icon:2,time:1500});
			}
		})
		$(".del").click(function(){
			var id=$(this).attr('data-id');
			del(id);
		})
		$(".student-look").click(function(){
			var id=$(this).attr("data-id");
				url="{:url('student_info')}?id="+id;
			open=layer.open({
				type:2,
				title:'学员信息',
				content:url
			})
			layer.full(open);
		})
		$(".getList").click(function(){
			var num={$list->total()};
			if(num>5000){
				layer.alert('下载内容过大，请筛选后重新下载');return false;
			}
				stime=$("input[name=stime]").val();
				etime=$("input[name=etime]").val();
				sname=$("input[name=sname]").val();
				//sid=$("select[name=sid]").find("option:selected").val();
				url="{:url('excel/get_student_card')}"+"?stime="+stime+"&etime="+etime+"&sname="+sname;//console.log(url);return false;
			location.href=url;//+"&sid="+sid
		})
	</script>
</body>
</html>